package pl.prv.polanie.client.dto;

import com.google.gwt.user.client.rpc.IsSerializable;



/**
 * SubjectEventDTO entity. @author MyEclipse Persistence Tools
 */

public class SubjectEventDTO extends java.lang.Object implements IsSerializable {


    // Fields    

     private long id;
     /**
      *  0 - zajecia odbywaja sie w kazdym tygodniu
      *  1 - parzysty (dolny lewy) 
      *  2 - nieparzysty (gorny prawy)
      */ 
     private int eventSort;
     private SubjectDTO subject;
     private RoomDTO room;
     private SubgroupDTO subgroup;
     private LecturerDTO lecturer;
     private CalendarDayDTO calendarDay;
     private Integer startTime;
     private Integer duration;


    // Constructors

    /** default constructor */
    public SubjectEventDTO() {
    }

    /** full constructor */
	public SubjectEventDTO(int eventSort, SubjectDTO subject, RoomDTO room,
			SubgroupDTO subgroup, LecturerDTO lecturer,
			CalendarDayDTO calendarDay, Integer startTime, Integer duration) {
		super();
		this.eventSort = eventSort;
		this.subject = subject;
		this.room = room;
		this.subgroup = subgroup;
		this.lecturer = lecturer;
		this.calendarDay = calendarDay;
		this.startTime = startTime;
		this.duration = duration;
	}

	
    // Property accessors
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public SubjectDTO getSubject() {
		return subject;
	}

	public void setSubject(SubjectDTO subject) {
		this.subject = subject;
	}

	public RoomDTO getRoom() {
		return room;
	}

	public void setRoom(RoomDTO room) {
		this.room = room;
	}

	public SubgroupDTO getSubgroup() {
		return subgroup;
	}

	public void setSubgroup(SubgroupDTO subgroup) {
		this.subgroup = subgroup;
	}

	public LecturerDTO getLecturer() {
		return lecturer;
	}

	public void setLecturer(LecturerDTO lecturer) {
		this.lecturer = lecturer;
	}

	public CalendarDayDTO getCalendarDay() {
		return calendarDay;
	}

	public void setCalendarDay(CalendarDayDTO calendarDay) {
		this.calendarDay = calendarDay;
	}

	public Integer getStartTime() {
		return startTime;
	}

	public void setStartTime(Integer startTime) {
		this.startTime = startTime;
	}

	public Integer getDuration() {
		return duration;
	}

	public void setDuration(Integer duration) {
		this.duration = duration;
	}

	
	public int getEventSort() {
		return eventSort;
	}
	
	public void setEventSort(int eventSort) {
		this.eventSort = eventSort;
	}
	
    
	public String toString() {
		String r;
		
		r = "id." + id + " -> cd: " + calendarDay + ", startTime: " + startTime; 
		return r;
	}


	public String toLabel() {
		String r;
		
		String cdS;
		if (calendarDay != null) {
			cdS = calendarDay.getDayLabel();
		} else {
			cdS = "day not assigned";
		};
		
		
		String lecturerS;
		if (lecturer != null) {
			lecturerS = lecturer.toLabel();
		} else {
			lecturerS = "lecturer not assigned";
		}
		
		
		String roomS;
		if (room != null) {
			roomS = room.getName();
		} else {
			roomS = "room not assigned";
		}
		
		
		r = eventSort + ", " + subgroup.getGroup().getName() + " " + subject.getSubjectName().getName() + " [" + subject.getSubjectType().getInitial() + "] " +
			roomS + ", " + lecturerS + ", " + cdS;
		return r;
	}








}